package com.example.testgit.mapstruct;

import com.example.testgit.VO.LoanVO;
import com.example.testgit.entity.LoanDO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * @author: lyh
 * @create: 2023/5/8 20:49
 * Description：
 */
@Mapper
public interface LoanConverter {
    LoanConverter INSTANCE = Mappers.getMapper(LoanConverter.class);

    @Mappings({
            @Mapping(source = "acquireTime", target = "acquireTime", dateFormat = "yyyy-MM-dd")
    })
    LoanVO toVO(LoanDO loanDO);

    @Mappings({
            @Mapping(source = "acquireTime", target = "acquireTime", dateFormat = "yyyy-MM-dd")
    })
    List<LoanVO> toVOList(List<LoanDO> loanDOList);
}
